<template>
  <div>
    <!-- 
      按键修饰符
      .enter  监听回车按键
      .esc    监听返回(退出)按键
     -->
     <input @keydown.enter="enterFn"  type="text">
     <hr>
     <input @keydown.esc="escFn" type="text">
  </div>
</template>

<script>
export default {
  methods: {
      enterFn(){
      console.log("enter键被按下了");
    },
    escFn(){
      console.log("esc键被按下了");
    }
  }
}
</script>

<style>

</style>